<%--
  Created by IntelliJ IDEA.
  User: LLg
  Date: 2022/11/8
  Time: 14:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="AddSupplierTo" method="post">
    <div>
        供货商编号:<input type="text" name="supCode" id="supCode"><span style="color: pink"></span>
    </div>
<div>
    供货商:<input type="text" name="supName"><span style="color: pink">${supNameError}</span>
</div>
<div>
    供货商描述:<input type="text" name="supDesc"><span style="color: pink">${supDescError}</span>
</div>
<div>
    供货商联系人:<input type="text" name="supContact">
</div>
<div>
    联系电话:<input type="text" name="supPhone">
</div>
<div>
    供货商地址:<input type="text" name="supAddress">
</div>
<div>
    传真:<input type="text" name="supFax">
</div>
<div>
    <input type="submit">
</div>
    <script src="${pageContext.request.contextPath}/static/layui/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['jquery'],function () {
            var $ = layui.$;
            $('#supCode').blur(function (){
                if ($('#supCode').val()==""){
                    $('#supCode').next('span').text('')
                    return false;
                }
                $.get('supCodeExists?supCode='+this.value,function (data){
                    if (data!='true'){
                        //存在
                        $('#supCode').next('span').text('该账号已存在')
                    }else {
                        // 不存在
                        $('#supCode').next('span').text('账号可用')
                    }
                })
            })
        })
    </script>
</form>
</body>
</html>
